package com.tengju.settlement.domain.model.depository;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: 大木
 * @date: 2021/12/7 2:13 上午
 */
@Getter
@AllArgsConstructor
public enum AccountType {

    COMPANY(1,1, "企业"),
    PERSONAL(3,3, "个人"),
   ;

    Integer innerVal;
    Integer financeVal;
    String desc;

    public static AccountType ofInnerCode(Integer innerCode) {
        if (innerCode == null) {
            return null;
        }
        for (AccountType type : values()) {
            if (type.innerVal.equals(innerCode)) {
                return type;
            }
        }
        return null;
    }

    public static AccountType ofFinanceCode(Integer financeCode) {
        if (financeCode == null) {
            return null;
        }
        for (AccountType type : values()) {
            if (type.financeVal.equals(financeCode)) {
                return type;
            }
        }
        return null;
    }

}
